function CE.Mage(arg1, goat2)
--arg1 = "v1" or "v2" for debugging
--goat2: "0" = Buffs, "1" = Melee, "2" = Ranged or instant , 3 = Food and potions,
--goat2: "4" = Boss Burst buffs, "pvp" = PvP combo, "aoe" = aoe skils
    local Skill = {}
    local Skill2 = {}
    local i = 0
	-- CE globals
    local IgnorableMobs = CE.IgnorableMobs
	
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
	local phealth = PctH("player")
    local thealth = PctH("target")
	local playerHP = (UnitHealth("player"))
	local targetHP = UnitHealth("target")
	local pctEB1 = PctM("player")
	local pctEB2 = PctS("player")
    local EnergyBar1 = UnitMana("player")
	local EnergyBar2 = UnitSkill("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
	local ammo = (GetEquipSlotInfo(10) ~= nil)
	local zoneid = (GetZoneID() % 1000)
    local SeigeWar = (zoneid == 402) -- The "Seige War" Zone
    local boss = UnitSex("target") >= 3
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
	local PetExists = UnitExists("playerpet") 
	local MobName = UnitName("target")
	local bowslot = GetEquipSlotInfo(11) == "interface\\CharacterFrame\\Equipment-RangedSlot" -- check if you have bow equiped
	
	-- Food And pot Dropdown menu locales
	local Rebuff = tonumber(CE_Settings[CE.playerName]["Tab3"]["Rebuff"])
	local HpDef = tonumber(CE_Settings[CE.playerName]["Tab3"]["HpDef"])
	local HpDef_Use = (not pbuffs[CE.BuffCheck("HpDef")] or pbuffs[CE.BuffCheck("HpDef")].time <= Rebuff)
	local HpDef_Check = CE_Settings[CE.playerName]["Tab3"]["HpDef_Check"]
	local DmgFood = tonumber(CE_Settings[CE.playerName]["Tab3"]["DmgFood"])
	local DmgFood_Use = (not pbuffs[CE.BuffCheck("DmgFood")] or pbuffs[CE.BuffCheck("DmgFood")].time <= Rebuff)
	local DmgFood_Check = CE_Settings[CE.playerName]["Tab3"]["DmgFood_Check"]
	local SpeedPot = tonumber(CE_Settings[CE.playerName]["Tab3"]["SpeedPot"])
	local SpeedPot_Use = not pbuffs[CE.BuffCheck("SpeedPot")]
	local SpeedPot_Check = CE_Settings[CE.playerName]["Tab3"]["SpeedPot_Check"]
	local CritFood = tonumber(CE_Settings[CE.playerName]["Tab3"]["CritFood"])
	local CritFood_Use = not pbuffs[CE.BuffCheck("CritFood")]
	local CritFood_Check = CE_Settings[CE.playerName]["Tab3"]["CritFood_Check"]
	local CritPot = tonumber(CE_Settings[CE.playerName]["Tab3"]["CritPot"])
	local CritPot_Use = not pbuffs[CE.BuffCheck("CritPot")]
	local CritPot_Check = CE_Settings[CE.playerName]["Tab3"]["CritPot_Check"]
	local Sigil = tonumber(CE_Settings[CE.playerName]["Tab3"]["Sigil"])
	local Sigil_Use = not pbuffs[CE.BuffCheck("Sigil")]
	local Sigil_Check = CE_Settings[CE.playerName]["Tab3"]["Sigil_Check"]
	local ISFood =  tonumber(CE_Settings[CE.playerName]["Tab3"]["ItemShop"])
	local ISFood_Use = (not pbuffs[CE.BuffCheck("ItemShop")] or pbuffs[CE.BuffCheck("ItemShop")].time <= Rebuff)
	local ISFood_Check = CE_Settings[CE.playerName]["Tab3"]["ItemShop_Check"]
	local Realgar = CE_Settings[CE.playerName]["BurstSlim"]["Realgar"]
	local Realgar_Use = (not pbuffs[501616] or pbuffs[501616].time <= Rebuff)
	local Hero = CE_Settings[CE.playerName]["BurstSlim"]["Hero_Pot"]
	local Hero_Use = (not pbuffs[501337] or pbuffs[501337].time <= Rebuff)
	local LongBuff = CE_Settings[CE.playerName]["BurstSlim"]["5MinBuff"]
	
    --Silence, Substitute and Protect Logic
	local silenceList = CE.silenceList
	local protectList = CE.protectList
	local subList = CE.subList
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    local protect = tSpell and protectList[tSpell] and ((tTime - tElapsed) > 0.1)
    local subThis = tSpell and subList[tSpell] and ((tTime - tElapsed) > 0.1)
	
	--Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )
	
    --Begin Player Skill Sequences
    
        --Rogue = THIEF, Scout = RANGER, Mage = MAGE, Knight = KNIGHT, 
        --Druid = DRUID, Priest = AUGUR, Warden = WARDEN, Warrior = WARRIOR
		--Champion = PSYRON, Warlock = HARPSYN
        
		
	--#####################--
       --# MAGE CLASS COMBOS #--
	--#####################--
	if mainClass == "MAGE" then
		----------------
		-- MAGE/ROGUE --
		----------------
		if subClass == "THIEF" then
			--Timers for this class
			CreateDIYCETimer("MRFlame", 15) --Change the value between 1.2 -> 2 depending on your lag
			--goat2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
									
			if (goat2 == "0") then --buffovi
				Skill =  {
					{ name = "Shadow Protection",                   use = (not pbuffs["Shadow Protection"]) },
					{ name = "Fang Ritual",                      	use = ((not pbuffs["Fang Ritual"])) },
					{ name = "Fire Ward",                      		use = ((not pbuffs["Fire Ward"])) },
					{ name = "Energy Influx",                      	use = ((not pbuffs["Energy Influx"])) }, --if energy influx is on lv60+ you can use it all the time
					{ name = "ItemID: 207200",		use = not pbuffs[506684] and CE.HaveItem(207200) and CE.ItemCD(207200)},	-- Unbridled Enthusiasm
					{ name = "ItemID: 207202", 		use = not pbuffs[506686] and CE.HaveItem(207202) and CE.ItemCD(207202)},	-- Clear Thought
					{ name = "ItemID: 207203",		use = not pbuffs[506687] and CE.HaveItem(207203) and CE.ItemCD(207203)},	-- Lucky Target
					{ name = "ItemID: 207206", 		use = not pbuffs[506690] and CE.HaveItem(207206) and CE.ItemCD(207206)},	-- Scarlet Love
						}
			elseif (goat2 == "3") then -- buffovi pre boss-a
				Skill =  {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
					{ name = "Energy Influx",                      	use = (not pbuffs["Energy Influx"]) },
					{ name = "Intensification",                     use = (not pbuffs["Intensification"]) },
					{ name = "Elemental Catalysis",                 use = (not pbuffs["Elemental Cataclysis"]) },
					{ name = "Flame",                     			use = (boss) },
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
			
			if ((enemy) and (goat2 == "2")) then -- instant skilovi
				Skill2 = {
					{ name = "Elemental Weakness",   				use = ((boss) and (not tbuffs["Elemental Weakness"])) },
					{ name = "Energy Well",                      	use = (pctEB1 < 0.50) },
					--{ name = "Action: 65 (Recover Magic)",          use = (pctEB1 < 0.40) },
					{ name = "Lightning",                      		use = (true) },
					{ name = "Fireball",							use = (true) },
						}
			elseif ((enemy) and (goat2 == "1")) then -- boss fight
				Skill2 = {
					{ name = "Silence",                 		    use = ((boss or elite) and (silenceThis) and (not tbuffs["Demoralized"])) },
					{ name = "Demoralize",                 		    use = ((boss or elite) and (silenceThis) and (not tbuffs["Silence"])) },
					{ name = "Electrostatic Charge",                use = (phealth < 0.80) },
					{ name = "Kiss of the Vampire",          		use = (((phealth < 0.90) and (thealth < 1)) or (phealth < 0.50)) },
					{ name = "Energy Well",                      	use = (pctEB1 < 0.50) },
					--{ name = "Action: 65 (Recover Magic)",          use = (pctEB1 < 0.40) },
					--{ name = "Action: 42 (HP pot)",          		use = (phealth < 0.10) },
					{ name = "Cursed Fangs",                     	use = ((not tbuffs["Cursed Fangs"]) and (thealth < 1) and (not pbuffs["Elemental Cataclysis"])) },
					{ name = "Fireball",							use = (thealth < 1) },
					{ name = "Plasma Arrow",                     	use = (not pbuffs["Charged"]) },
					{ name = "Flame",                     			use = (true) },
					}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end
		----------------
		-- MAGE/SCOUT -- 26/12/2013
		----------------
		elseif subClass == "RANGER" then
			--Timers for this class
			CreateDIYCETimer("MSShot", 1.2) --Change the value between 1.2 -> 2 depending on your lag.
			--goat2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
									
			if (goat2 == "0") then -- Long Buffs
				Skill =  {
					{ name = "ID: 490248",			use = not pbuffs[500366] },							-- Fire Ward
					{ name = "ID: 499597",			use = not pbuffs[623185] },							-- Wind Fire Cultivation
					{ name = "ID: 490218",       	use = not pbuffs[500296] }, 						-- Energy Influx
					{ name = "ItemID: 207200",		use = not pbuffs[506684] and CE.HaveItem(207200) and CE.ItemCD(207200)},	-- Unbridled Enthusiasm
					{ name = "ItemID: 207202", 		use = not pbuffs[506686] and CE.HaveItem(207202) and CE.ItemCD(207202)},	-- Clear Thought
					{ name = "ItemID: 207203",		use = not pbuffs[506687] and CE.HaveItem(207203) and CE.ItemCD(207203)},	-- Lucky Target
					{ name = "ItemID: 207206", 		use = not pbuffs[506690] and CE.HaveItem(207206) and CE.ItemCD(207206)},	-- Scarlet Love
						}
			elseif goat2 == "3" then	-- Boss burst buffs
				Skill = {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ID: 499597",			use = not pbuffs[623185] },										-- Wind Fire Cultivation
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check },	-- Critical hit food
					{ name = "ID: 491577",			use = not pbuffs[620185] },										-- Flame Spirit
					{ name = "ID: 497976",			use = (not pbuffs[620177]) and (boss or elite) },				-- Intensification
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check },	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check },	-- Critical hit pot
					{ name = "ID: 497971",			use = (not pbuffs[620176]) and (boss or elite) and LongBuff },	-- Elemental Catalise
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
			
			if ((enemy) and (goat2 == "2")) then -- Ranged or instant skills
				Skill2 = {
					{ name = "Func: CE.Pot()",	use = ((phealth < 0.60) and CE.PotCD() and (not SeigeWar))},	-- Phirius pot healing
					{ name = "ID: 490296",	use = silenceThis },					-- Silence
					{ name = "ID: 497977",	use = boss and (not tbuffs[620189]) },	-- Elemental Weakness
					{ name = "ID: 499597",	use = not pbuffs[623185] },				-- Wind Fire Cultivation
					{ name = "ID: 490251",	use = pctEB1 < 0.50 },					-- Energy Well
					{ name = "ID: 490212",	use = true },							-- Lightning
					{ name = "ID: 490204",	use = true },							-- Fireball
					{ name = "ID: 499598",	use = true },							-- Shot
						}
			elseif ((enemy) and (goat2 == "1")) then -- Main Dps Combo
				Skill2 = {
					{ name = "Func: CE.Pot()",	use = ((phealth < 0.60) and CE.PotCD() and (not SeigeWar))},	-- Phirius pot healing
					{ name = "ID: 490296",	use = silenceThis },		-- Silence
					{ name = "ID: 497977",	use = boss and (not tbuffs[620189]) },	-- Elemental Weakness
					{ name = "ID: 499597",	use = not pbuffs[623185] },	-- Wind Fire Cultivation
					{ name = "ID: 490251",	use = pctEB1 < 0.50 },		-- Energy Well
					{ name = "ID: 491150",	use = (true) },				-- Flame
						}
			elseif ((enemy) and (goat2 == "shot_only")) then -- Shot only
				Skill2 = {
					{ name = "Func: CE.Pot()",	use = ((phealth < 0.60) and CE.PotCD() and (not SeigeWar))},	-- Phirius pot healing
					{ name = "ID: 490296",		use = silenceThis },					-- Silence
					{ name = "ID: 497977",		use = boss and (not tbuffs[620189]) },	-- Elemental Weakness
					{ name = "ID: 499597",		use = not pbuffs[623185] },				-- Wind Fire Cultivation
					{ name = "ID: 499598",		use = true },							-- Shot
						}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {
					{ name = "ID: 490296",	use = silenceThis },					-- Silence
					{ name = "ID: 490212",	use = true },							-- Lightning
					{ name = "ID: 499597",	use = not pbuffs[623185] },				-- Wind Fire Cultivation
					{ name = "ID: 499598",	use = true },							-- Shot
					{ name = "ID: 490204",	use = true },							-- Fireball
						}
			end
		-----------------
		-- MAGE/KNIGHT --
		-----------------
		elseif subClass == "KNIGHT" then
			if (goat2 == "0") then -- Long bufs
				Skill = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif goat2 == "3" then -- Burst boss buff's
				Skill = {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
				
			if ((enemy) and (goat2 == "1")) then -- Main DPS combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "2")) then -- Ranged or instant skils combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end
		----------------
		-- MAGE/DRUID --
		----------------
		elseif subClass == "DRUID" then
			if (goat2 == "0") then -- Long bufs
				Skill = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif goat2 == "3" then -- Burst boss buff's
				Skill = {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
				
			if ((enemy) and (goat2 == "1")) then -- Main DPS combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "2")) then -- Ranged or instant skils combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end
		-----------------
		-- MAGE/PRIEST --
		-----------------
		elseif subClass == "AUGUR" then
			--goat2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
									
			if (goat2 == "0") then --buffovi
				Skill =  {
					{ name = "Essence of Magic",                    use = (not pbuffs["Essence of Magic"]) },
					{ name = "Fire Ward",                      		use = (not pbuffs["Fire Ward"]) },
					{ name = "Magic Barrier",             			use = (not pbuffs["Magic Barrier"]) },
					{ name = "Blessed Spring Water",             	use = (not pbuffs["Blessed Spring Water"]) },
					{ name = "ItemID: 207200",		use = not pbuffs[506684] and CE.HaveItem(207200) and CE.ItemCD(207200)},	-- Unbridled Enthusiasm
					{ name = "ItemID: 207202", 		use = not pbuffs[506686] and CE.HaveItem(207202) and CE.ItemCD(207202)},	-- Clear Thought
					{ name = "ItemID: 207203",		use = not pbuffs[506687] and CE.HaveItem(207203) and CE.ItemCD(207203)},	-- Lucky Target
					{ name = "ItemID: 207206", 		use = not pbuffs[506690] and CE.HaveItem(207206) and CE.ItemCD(207206)},	-- Scarlet Love
					{ name = "Energy Influx",                      	use = (not pbuffs["Energy Influx"]) }, --if energy influx is on lv60+ you can use it all the time
						}
			elseif (goat2 == "3") then -- buffovi pre boss-a
				Skill =  {
					{ name = "Energy Influx",                      	use = ((not pbuffs["Energy Influx"])) },
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
					{ name = "Intensification",                     use = ((not pbuffs["Intensification"])) },
					{ name = "Elemental Catalysis",                 use = ((not pbuffs["Elemental Cataclysis"])) },
					{ name = "Flame",                     			use = (boss) },
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
			
			if ((enemy) and (goat2 == "1")) then -- instant skilovi
				Skill2 = {
					{ name = "Regenerate",             				use = ((not pbuffs["Regenerate"]) and (phealth < 0.80)) },
					{ name = "Urgent Heal",             			use = (phealth < 0.50) },
					{ name = "Elemental Weakness",   				use = ((boss) and (not tbuffs["Elemental Weakness"])) },
					{ name = "Energy Well",                      	use = (pctEB1 < 0.50) },
					{ name = "Action: 65 (Recover Magic)",          use = (pctEB1 < 0.40) },
					{ name = "Lightning",                      		use = (true) },
					{ name = "Fireball",							use = (true) },
					{ name = "Rising Tide",							use = (true) },
					{ name = "Flame",                     			use = (true) },
						}
			elseif ((enemy) and (goat2 == "2")) then -- boss fight
				Skill2 = {
					{ name = "Urgent Heal",             			use = (phealth < 0.05) },
					{ name = "Holy Aura",             				use = (phealth < 0.06) },
					{ name = "Magic Drain",                 		use = (boss) },
					{ name = "Silence",                 		    use = ((boss or elite) and (silenceThis)) },
					{ name = "Energy Well",                      	use = (pctEB1 < 0.50) },
					{ name = "Action: 65 (Recover Magic)",          use = (pctEB1 < 0.40) },
					{ name = "Action: 41 (HP pot)",          		use = (phealth < 0.10) },
					{ name = "Flame",                     			use = (true) },
					}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end 
		-----------------
		-- MAGE/WARDEN --
		-----------------
		elseif subClass == "WARDEN" then
			if (goat2 == "0") then -- Long bufs
				Skill = {
					{ name = "ItemID: 207200",		use = not pbuffs[506684] and CE.HaveItem(207200) and CE.ItemCD(207200)},	-- Unbridled Enthusiasm
					--{ name = "ItemID: 207202", 		use = not pbuffs[506686] and CE.HaveItem(207202) and CE.ItemCD(207202)},	-- Clear Thought
					--{ name = "ItemID: 207203",		use = not pbuffs[506687] and CE.HaveItem(207203) and CE.ItemCD(207203)},	-- Lucky Target
					{ name = "ItemID: 207206", 		use = not pbuffs[506690] and CE.HaveItem(207206) and CE.ItemCD(207206)},	-- Scarlet Love}
					{ name = "ID: 499618",			use = not pbuffs[623216] },	-- Earth Scepter
					{ name = "ID: 493642",			use = not pbuffs[503958] },	-- Briar Shield
					{ name = "ID: 490218",			use = not pbuffs[500296] },	-- Energy Influx
					}
			elseif goat2 == "3" then -- Burst boss buff's
				Skill = {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
				
			if ((enemy) and (goat2 == "1")) then -- Main DPS combo
				Skill2 = {
					{ name = "ID: 491150",		use = pbuffs[623219] },
					{ name = "ID: 499620",		use = boss and (thealth <= .90 )},	-- Earth Core Barrier
						}
			elseif ((enemy) and (goat2 == "2")) then -- Ranged or instant skils combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end 
		------------------
		-- MAGE/WARRIOR --
		------------------
		elseif subClass == "WARRIOR" then
			if (goat2 == "0") then --buffovi
				Skill =  {
					{ name = "ID: 492630",			use = (not pbuffs[623531]) },
					{ name = "ID: 491563",			use = (not pbuffs[501948]) },
					{ name = "ID: 491562",			use = (not pbuffs[501947]) },
					{ name = "ID: 491564",			use = (not pbuffs[501949]) },
					{ name = "Fire Ward",			use = (not pbuffs["Fire Ward"]) },
					{ name = "ItemID: 207200",		use = not pbuffs[506684] and CE.HaveItem(207200) and CE.ItemCD(207200)},	-- Unbridled Enthusiasm
					{ name = "ItemID: 207202", 		use = not pbuffs[506686] and CE.HaveItem(207202) and CE.ItemCD(207202)},	-- Clear Thought
					{ name = "ItemID: 207203",		use = not pbuffs[506687] and CE.HaveItem(207203) and CE.ItemCD(207203)},	-- Lucky Target
					{ name = "ItemID: 207206", 		use = not pbuffs[506690] and CE.HaveItem(207206) and CE.ItemCD(207206)},	-- Scarlet Love
					{ name = "Energy Influx",		use = (not pbuffs["Energy Influx"]) },
						}
			elseif goat2 == "3" then -- Burst boss buff's
				Skill = {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
				
			if ((enemy) and (goat2 == "1")) then -- Main DPS combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "2")) then -- Ranged or instant skils combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end
		-------------------
		-- MAGE/CHAMPION --
		-------------------
		elseif subClass == "PSYRON" then
			if (goat2 == "0") then -- Long bufs
				Skill = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif goat2 == "3" then -- Burst boss buff's
				Skill = {
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},	-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },		-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },	-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },	-- ItemShop Hp/Def Food
						}
			end
				
			if ((enemy) and (goat2 == "1")) then -- Main DPS combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "2")) then -- Ranged or instant skils combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			elseif ((enemy) and (goat2 == "pvp")) then -- PVP combo
				Skill2 = {{ name = "Func: CE.NoCode()",	use = (true) }}
			end
		------------------
		-- MAGE/WARLOCK --
		------------------
		elseif subClass == "HARPSYN" then
			--Timers for this class
			CreateDIYCETimer("explosion", 10)
				
			--goat2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
			if (goat2 == "0") then --buffovi
				Skill =  {
					{ name = "Fire Ward",                      		use = ((not pbuffs["Fire Ward"]) or (pbuffs["Fire Ward"].time <= 45)) },
					{ name = "Energy Influx",                      	use = (not pbuffs["Energy Influx"]) }, --if energy influx is on lv60+ you can use it all the time
					{ name = "ItemID: 207200",		use = not pbuffs[506684] and CE.HaveItem(207200) and CE.ItemCD(207200)},	-- Unbridled Enthusiasm
					{ name = "ItemID: 207202", 		use = not pbuffs[506686] and CE.HaveItem(207202) and CE.ItemCD(207202)},	-- Clear Thought
					{ name = "ItemID: 207203",		use = not pbuffs[506687] and CE.HaveItem(207203) and CE.ItemCD(207203)},	-- Lucky Target
					{ name = "ItemID: 207206", 		use = not pbuffs[506690] and CE.HaveItem(207206) and CE.ItemCD(207206)},	-- Scarlet Love
				     }
			elseif goat2 == "3" then -- Burst boss buff's
				Skill = {
					{ name = "Energy Influx",                      	use = (not pbuffs["Energy Influx"]) },
					{ name = "Func: CE.Item("..Sigil..")",	use = Sigil_Use and CE.HaveItem(Sigil) and Sigil_Check and CE.ItemCD(Sigil)},		-- Sigil
					{ name = "ItemID: "..CritFood,	use = CritFood_Use and CE.HaveItem(CritFood) and CritFood_Check and CE.ItemCD(CritFood)},	-- Critical hit food
					{ name = "ItemID: "..SpeedPot,	use = SpeedPot_Use and CE.HaveItem(SpeedPot) and SpeedPot_Check and CE.ItemCD(SpeedPot)},	-- Cast or Attack speed pot
					{ name = "ItemID: "..CritPot,	use = CritPot_Use and CE.HaveItem(CritPot) and CritPot_Check and CE.ItemCD(CritPot) },		-- Critical hit pot
					{ name = "Intensification",                     use = (not pbuffs["Intensification"]) },
					{ name = "Elemental Catalysis",                 use = ((not pbuffs["Elemental Cataclysis"])) },
					{ name = "Flame",                     			use = (boss) },	
						}
			elseif goat2 == "4" then -- Food and potions
				Skill = {
					{ name = "ItemID: "..HpDef,			use = HpDef_Use and CE.HaveItem(HpDef) and HpDef_Check and CE.ItemCD(HpDef) },			-- Hp or Defense food
					{ name = "ItemID: "..DmgFood, 		use = DmgFood_Use and CE.HaveItem(DmgFood) and DmgFood_Check and CE.ItemCD(DmgFood) },	-- Attack or damage food
					{ name = "ItemID: 200277",			use = Hero_Use and CE.HaveItem(200277) and Hero and CE.ItemCD(200277) },				-- Hero potion
					{ name = "ItemID: 202242",			use = Realgar_Use and CE.HaveItem(202242) and Realgar and CE.ItemCD(202242) },			-- Aged Realgar Wine
					{ name = "Func: CE.ISFood()",		use = ISFood_Use and CE.HaveItem(ISFood) and ISFood_Check and CE.ItemCD(ISFood) },		-- ItemShop Hp/Def Food
						}
			end
			
			if ((enemy) and (goat2 == "2")) then -- instant skilovi
				Skill2 = {
					{ name = "Elemental Weakness",   				use = ((boss) and (not tbuffs["Elemental Weakness"])) },
					{ name = "Energy Well",                      	use = (pctEB1 < 0.50) },
					--{ name = "Action: 65 (Recover Magic)",          use = (pctEB1 < 0.40) },
					{ name = "Lightning",                      		use = (true) },
					{ name = "Fireball",							use = (true) },
						}
			elseif ((enemy) and (goat2 == "1")) then -- boss fight
					Skill2 = {
					{ name = "Func: CE.Pot()",   				use = ((phealth < 0.60) and CE.PotCD() and (not SeigeWar))},
					{ name = "Silence",                 		    use = ((boss or elite) and (silenceThis)) },
					{ name = "Energy Well",                      	use = (pctEB1 < 0.50) },
					{ name = "Action: 65 (Recover Magic)",          use = (pctEB1 < 0.40) },
					{ name = "Action: 42 (Phirus pot)",          	use = (phealth < 0.15) },
					{ name = "Warp Charge",                     	use = ((EnergyBar2 >= 30) and ((not pbuffs["Warp Charge"]) or (pbuffs["Warp Charge"].time <= 2))) },
					{ name = "Fire Lightning Burst",                use = (EnergyBar2 >= 25) },
					{ name = "Electric Explosion",                  use = ((pbuffs["Charged"]) and ((not pbuffs["Fire Spirit Pride"]) or (pbuffs["Fire Spirit Pride"].time <= 4))) },
					{ name = "Plasma Arrow",                     	use = ((not pbuffs["Charged"]) or (pbuffs["Charged"].time <= 3)) },
					{ name = "Flame",                     			use = (true) },
						}
			elseif ((enemy) and (goat2 == "pvp")) then -- PvP testing
					Skill2 = {
					{ name = "Silence",                 		    use = (silenceThis) },
					{ name = "Static Resonance",                	use = (not CD("Electrostatic Charge")) },
					{ name = "Lightning",                      		use = (true) },
					{ name = "Fireball",                     		use = (true) },
					{ name = "Electrostatic Charge",                use = (not pbuffs["Electrostatic Charge"]) },
					{ name = "Warp Charge",                     	use = ((EnergyBar2 >= 30) and ((not pbuffs["Warp Charge"]) or (pbuffs["Warp Charge"].time <= 2))) },
					{ name = "Surge of Malice",                     use = (EnergyBar2 >= 20) },
					{ name = "Fire Lightning Burst",                use = (EnergyBar2 >= 25) },
					{ name = "Plasma Arrow",                     	use = ((not pbuffs["Charged"]) or (pbuffs["Charged"].time <= 3)) },
					{ name = "Flame",                     			use = (true) },
						}
			end
		end
	end
    --End Player Skill Sequences
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
end
